#pragma once
#include <action\Action.h>
#include <action\BasicMenuAction.h>
#include "GameCore.h"

class FadeAction : public ds::Action {

public:
	FadeAction() : ds::Action("Fade") , m_Timer(0.0f) {
		m_FadeHandle = gEngine->getResourceManager().findByName("PP",ds::RS_SHADER);		
	}
	~FadeAction() {}
	void start() {
		m_Timer = 0.0f;
		ds::Shader& shader = gEngine->getResourceManager().getShader(m_FadeHandle);
		shader.setFloat("timer",m_Timer);
		shader.setActive(true);
		setActive(true);
	}
	void stop() {
		ds::Shader& shader = gEngine->getResourceManager().getShader(m_FadeHandle);
		m_Timer = 0.0f;
		shader.setFloat("timer",m_Timer);
		shader.setActive(false);
		setActive(false);
	}
	void update(float elapsed);
private:
	ds::ResourceHandle m_FadeHandle;
	float m_Timer;
};

// ---------------------------------------------------
//  Game over menu
// ---------------------------------------------------
class GameOverMenuAction : public ds::BasicMenuAction {

public:
	GameOverMenuAction(const std::string& materialName,const std::string& layerName,GameCore* core);
	virtual ~GameOverMenuAction() {}		
	virtual void start();
private:
	GameCore* m_Core;
};

// ---------------------------------------------------
//  score menu
// ---------------------------------------------------
class HighscoreMenuAction : public ds::BasicMenuAction {

public:
	HighscoreMenuAction(const std::string& materialName,const std::string& layerName,GameCore* core);
	virtual ~HighscoreMenuAction() {}		
	virtual void start();
private:
	void setHighscore(int level);
	GameCore* m_Core;
};